require('./utils/Page')
//app.js
const baseURL = 'https://obuge.com/juzao'
let $https = require("./utils/request")
wx.$https =$https
wx.get = $https.get
wx.baseURL =baseURL
wx.put = $https.put
wx.post = $https.post
wx.delete = $https.delete
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        wx.get('http://localhost:3000/wxlogin?code=' + res.code).then(res=>{
          console.log("111",res)
          wx.userInfo = res
          wx.token = res.token
          if(wx.waitLoginPages.length){
            for(let i =0; i<wx.waitLoginPages.length;i++) {
              let page = wx.waitLoginPages[i]
              page.onLoad.call(page.context,page.options)
            }
          }
        })
      }
    })
  },
  globalData: {
    userInfo: null
  }
})